﻿@inherits BaseForm<SysModule>

<DataSteps Model="model" />

@code {
    private StepModel model = new() { IsContent = true };

    protected override void OnInitialized()
    {
        model.Items.Add(new("基本信息") { Content = @<ModuleInfo Model="Model" /> });
        model.Items.Add(new("页面设置") { Content = @<ModulePage Model="Model" /> });
        model.Items.Add(new("表单设置") { Content = @<ModuleForm Model="Model" /> });
        model.IsView = Model.IsView;
        model.OnSave = SaveAsync;
    }

    private async Task<bool> SaveAsync(bool isClose = false)
    {
        if (!Model.Validate())
            return false;

        await Model.SaveAsync(isClose);
        return true;
    }
}